<!doctype html>
<html>

<head>
  <meta charset="UTF-8">
  <title>抄表修改</title>
  <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="apple-mobile-web-app-status-bar-style" content="black">
  <link href="../css/mui.min.css" rel="stylesheet"/>
  <link rel="stylesheet" href="../css/1px.css"/>
  <style>
    html {
      font-family: Roboto, Arial, "Noto Sans CJK SC", "Noto Sans CJK TC", "Pingfang SC", "Microsoft Yahei", "WenQuanYi Micro Hei", sans-serif;
    }

    body {
      overflow-x: hidden;
      background-color: #fff !important;
      font-size: 13px;
    }

    .mui-content {
      font-size: 13px;
      background-color: #fff;
    }

    .mui-card {
      background-color: #efeaea;
      box-sizing: border-box;
      padding: 5px;
      font-size: 13px;
      line-height: 22px;
    }

    .item-box {
      padding-bottom: 10px;
      margin-bottom: 10px;
      overflow: hidden;
      border-bottom: 4px solid #FFFFFF;
      position: relative;
    }

    .mui-card input {
      height: 22px;
      padding: 0 5px;
      margin-bottom: 5px;
      font-size: 14px;
    }

    .device-type {
      font-size: 18px;
      font-weight: bold;
      margin-bottom: 4px;
    }

    .device-describe {
      float: right;
    }

    .pad-lef {
      padding-right: 10px;
    }

    .colorRed {

    }

    .unit-price {
      text-align: center;
      font-size: 12px;
      font-weight: bold;
      position: absolute;
      bottom: 2px;
      left: 5px;
    }

    .avr-price {
      display: inline-block;
      font-size: 12px;
      color: #8ea9ff;
    }

    .blue {
      color: #8ea9ff
    }

    .warn_red2 {
      color: red
    }

    .mui-card button {
      height: 28px;
      padding: 4px 8px;
    }

    .save-btn-box {
      float: right;
      margin-right: 10px;
    }

    .save-btn {
      background-color: #FF9800;
      border-color: #FF9800
    }

    .save-btn:active {
      background-color: #ff6600
    }

    /**/

    .no {
      text-align: center;
      margin-top: 200px;
      color: #CCCCCC;
      font-size: 16px;
    }

    /**/

    .mask {
      position: absolute;
      z-index: 10;
      width: 100%;
      height: 100%;
      background-color: rgb(255, 255, 255);
      font-size: 18px;
      color: #999;
      text-align: center;
      padding-top: 50px;
    }

    /*加载*/

    .mui-pull-bottom-pocket {
      visibility: visible;
    }

    .mui-pull-bottom-pocket .mui-pull-loading {
      visibility: visible;
    }

    /*.footer {
      height: 30px;
      position: absolute;
      bottom: 0;
      text-align: center;
      width: 100%;
      margin-bottom: 6px;
    }*/

    .save-all-btn {
      background-color: #ff6600;
      border-color: #ff6600;
    }

    .save-all-btn:active {
      background-color: #f1721d;
    }

    .mui-scroll-wrapper {
      /*bottom: 40px;*/
    }

    .mui-scroll {
      touch-action: none;
    }

    /**/

    .savedNum {
      display: inline-block;
      text-align: left;
      width: 40%;
    }

    .small-font {
      display: inline-block;
      text-align: right;
      width: 50%;
      font-size: 12px;
    }

    .hr {
      width: 100%;
      margin: 0 auto;
      border-top: 1px solid RGB(214, 208, 208);
      display: inline-block;
      margin: 0;
      padding: 0;
    }

    .red1 {
      color: red
    }
  </style>
</head>

<body>
<script src="../js/mui.min.js"></script>
<script type="text/javascript">
  mui.init()
</script>
<div id="app" class="mui-content">
  <div class="mask" v-show="isInit">加载中...</div>

  <div class="mui-scroll-wrapper" >
    <div class="mui-scroll" v-show='isShow'>
      <div class="mui-row" style="padding: 10px 0 0 15px">
        <span class="mui-col-xs-5 mui-col-sm-6">抄表人:<span v-text="userInfo.name"></span></span>
        <span class="mui-col-xs-7 mui-col-sm-6">抄表时间:<span
          v-text=' new Date(userInfo.time).format("yyyy-MM-dd hh:mm ") '></span>
      </div>
      <div class="mui-card">
        <div v-for="(item,index) in list" :key="index" class="item-box">
          <div class="device-type">
            <span v-text="item.type===1?'礼品机':item.type===0?'兑币机':'娱乐机'"></span>
            <span class="device-describe">{{item.deviceName}}-{{item.deviceStoreNo}}号机</span>
            <span
              style='border-top:1px solid RGB(214,208,208);display: inline-block;width: 75%; vertical-align: middle;'></span>
            <!--<span style='margin-left: 7%;font-size: 14px; color:RGB(214,208,208)'>{{item.note?'('+item.note+')':''}}</span>-->
          </div>
          <div class="mui-row">
            <div v-if="item.type===1" class="mui-row">
              <div class="mui-col-xs-6 mui-col-sm-6 pad-lef">
                投币码表：<span class="colorRed">底数<span v-text="item.lastCoinsCount"></span></span>
              </div>
              <div class="mui-col-xs-6 mui-col-sm-6">
                <!--@blur='blur(item.lastAddCoinsCount,item.coinsCount,item.lastCoinsCount,item.coinsNegativeVigilance,item.coinsPlusVigilance,index)'-->
                <input style="width: 45%;" type="number" v-model="item.coinsCount" v-if="!item.ifSave"/>
                <span class="savedNum" v-show="item.ifSave" v-text="item.coinsCount"></span>
                <span class="small-font" v-show="item.coinsCount" :class='{"red1":!item.isTrue}'>投币:{{item.coinsCount-item.lastCoinsCount}}</span>
              </div>
              <div class="mui-col-xs-6 mui-col-sm-6 pad-lef">
                礼品码表：<span class="colorRed">底数<span v-text="item.lastRewardCount"></span></span>
              </div>

              <div class="mui-col-xs-6 mui-col-sm-6">
                <!---->
                <input type="number" style="width: 45%;"
                       @blur='blur2(item.lastAddRewardCount,item.rewardCount,item.lastRewardCount,item.rewardNegativeVigilance,item.rewardPlusVigilance,index,item.type)'
                       v-model="item.rewardCount" v-if="!item.ifSave"/> <span
                class="savedNum" v-show="item.ifSave" v-text="item.rewardCount"></span>
                <span class="small-font" v-show="item.rewardCount" :class='{"red1":!item.isTrue2}'>返奖:{{item.rewardCount-item.lastRewardCount}}</span>
              </div>
              <span class='hr'></span>
              <!--v-if="meterType===1"-->
              <div v-if='item.type ===1'>
                <div v-for="(innerItem,ind) in item.rewards" class="mui-row"
                     style='border-bottom:1px solid RGB(214,208,208);margin-bottom: 5px;'>
                  <div class="mui-col-xs-12  mui-col-sm-12">
                    礼品名称：<span v-text="innerItem.rewardName"></span>
                  </div>
                  <div class="mui-col-xs-4 mui-col-sm-4"> 
                    账面余量：<span v-text=" innerItem.rewardTrue? innerItem.rewardCount1:innerItem.rewardCount "></span>
                  </div>
                  <div class="mui-col-xs-3 mui-col-sm-3 " style="text-align: right;">
                    机台余量：
                  </div>
                  <div class="mui-col-xs-2 mui-col-sm-2" style="margin-right: 13px">
                    <input type="number" v-if="!item.ifSave" v-model="innerItem.meterAmount"/>
                    <span v-show="item.ifSave" v-text="innerItem.meterAmount"></span>
                  </div>
                  <p class="mui-col-xs-2 mui-col-sm-2" style='text-align: left; font-size:12px'
                     :class='{"warn_red2":innerItem.isRed}' v-show='innerItem.isTrue'>
                    误差:{{goodsErroor(innerItem.rewardCount,innerItem.meterAmount,index,ind)}}</p>
                </div>
              </div>
              <div class="unit-price colorRed">
                <p class="avr-price">本期单价：<span v-text="MathPrice(index)"></span>元</p>
                <span :style="{color:item.color ===1 ? 'red' : item.color ===2 ? '#8ea9ff' :'#ff6600'}"> &emsp;礼品误差：{{goodsTotalErroor(index)}}</span>
              </div>
            </div>
            <!--0-->
            <div v-if="item.type===0" class="mui-row">
              <div  class="mui-row" style="border-bottom: 1px solid RGB(214,208,208);margin-bottom: 0.4rem;padding-bottom: 0.6rem">
                <div class="mui-col-xs-6 mui-col-sm-6 pad-lef" >
                		  本期现金：
                </div>
                <div class="mui-col-xs-6 mui-col-sm-6"  >
                  <input style="width: 45%;" type="number" v-model="item.cashAmount" v-if="!item.ifSave"/><span class="savedNum" v-show="item.ifSave" v-text="item.cashAmount"></span>
                </div>
              </div>
              <div class="mui-col-xs-6 mui-col-sm-6 pad-lef">
                累计收入：<span class="colorRed">底数<span v-text="item.lastIncomeAmount"></span></span>
              </div>
              <div class="mui-col-xs-6 mui-col-sm-6">
                <input style="width: 45%;" type="number"
                       @blur="blur2(item.lastAddIncomeAmount,item.incomeAmount,item.lastIncomeAmount,item.cashNegativeVigilance,item.cashPlusVigilance,index)"
                       v-model="item.incomeAmount" v-if="!item.ifSave"/><span class="savedNum" v-show="item.ifSave"
                                                                            v-text="item.incomeAmount"></span>
                <span class="small-font" v-show="item.incomeAmount " :class='{"red1":!item.isTrue2}'>差值:{{item.incomeAmount-item.lastIncomeAmount}}</span>
              </div>

              <div class="mui-col-xs-6 mui-col-sm-6 pad-lef">
                累计出币：<span class="colorRed">底数<span v-text="item.lastBuyCoinNum"></span></span>
              </div>
              <div class="mui-col-xs-6 mui-col-sm-6">
                <input style="width: 45%;" type="number"
                       @blur="blur2(item.lastAddCoinNum,item.buyCoinNum,item.lastBuyCoinNum,item.buyCoinNegativeVigilance,item.buyCoinPlusVigilance,index,item.type)"
                       v-model="item.buyCoinNum" v-if="!item.ifSave"/><span class="savedNum" v-show="item.ifSave"
                                                                            v-text="item.buyCoinNum"></span>
                <span class="small-font" v-show="item.buyCoinNum " :class='{"red1":!item.isTrue2}'>出币:{{item.buyCoinNum-item.lastBuyCoinNum}}</span>
              </div>
            </div>

            <!--2-->
            <div v-if="item.type===2" class="mui-row">
              <div class="mui-col-xs-6 mui-col-sm-6 pad-lef">
                投币码表：<span class="colorRed">底数<span v-text="item.lastCoinsCount"></span></span>
              </div>
              <div class="mui-col-xs-6 mui-col-sm-6">
                <!--@blur="blur(item.lastAddCoinsCount,item.coinsCount,item.lastCoinsCount,item.coinsNegativeVigilance,item.coinsPlusVigilance,index)"-->
                <input style="width: 45%;" type="number" v-model="item.coinsCount" v-if="!item.ifSave"/>
                <span class="savedNum" v-show="item.ifSave" v-text="item.coinsCount"></span>
                <span class="small-font" v-show="item.coinsCount" :class='{"red1":!item.isTrue}'>投币:{{item.coinsCount-item.lastCoinsCount}}</span>
              </div>
              <div class="mui-col-xs-6 mui-col-sm-6 pad-lef">
                彩票码表：<span class="colorRed">底数<span v-text="item.lastTicketsCount"></span></span>
              </div>
              <div class="mui-col-xs-6 mui-col-sm-6">
                <!--@blur="blur2(item.lastAddTicketsCount,item.ticketsCount,item.lastTicketsCount,item.ticketsNegativeVigilance,item.ticketsPlusVigilance,index,item.type)"-->
                <input style="width: 45%;" type="number" v-model="item.ticketsCount" v-if="!item.ifSave"/>
                <span class="savedNum" v-show="item.ifSave" v-text="item.ticketsCount"></span>
                <span class="small-font" v-show="item.ticketsCount " :class='{"red1":!item.isTrue2}'>出票:{{item.ticketsCount-item.lastTicketsCount}}</span>
              </div>
            </div>
          </div>
          <!---->
          <div class="save-btn-box">
            <button type="button" :disabled="item.ifSave" class="mui-btn mui-btn-success save-btn" v-show="!item.ifSave"
                    @click="save(index,item.type)">保存
            </button>
            <button type="button" class="mui-btn mui-btn-primary" v-show="item.ifSave" @click="edit(index,item.type)">
              修改
            </button>
          </div>
        </div>
      </div>
      <!--加载中-->
      <div class="mui-pull-bottom-pocket" v-show='isLoading'>
        <div class="mui-pull" v-text="loadingText">
        </div>
      </div>
      <!---->
    </div>
    <div class="no" v-show="list.length===0">
      暂无数据
    </div>
  </div>
</div>
</div>
</body>
<script src="../config.js"></script>
<script src="../js/vue.min.js"></script>
<script>
  mui.plusReady(function () {
    var vm = new Vue({
      el: '#app',
      data: {
      	isShow:true,
        userInfo: {},
        currentShopObj: {},
        error: '',
        params: {
          storeId: '',
          pageNo: 1,
          pageCount: 10,
        },
        list: [],
        isLoading: false,
        isInit: true,
        loadingText: '加载中...',
        logedAmount: 0,
        totalCount: 0,
        meterType: 0,
      },
      mounted: function () {
        this.receiveParams()
        this.loadData()
        this.bindEvent()
        var vm = this
        setTimeout(function () {
          vm.isInit = false
        }, 800)
      },
      methods: {
        receiveParams: function () {
          var self = plus.webview.currentWebview()
          this.currentShopObj = self.currentShopObj
          this.params.storeId = self.currentShopObj.storeId
          this.params.merchantId = self.currentShopObj.merchantId
        },
        bindEvent: function () {
          var vm = this
          mui('.mui-scroll-wrapper').scroll({
            scrollY: true,
            bounce: true,
            deceleration: 0.0005 //flick 减速系数，系数越大，滚动速度越慢，滚动距离越小，默认值0.0006，
          });
          //滚动监听
          document.querySelector('.mui-scroll-wrapper').addEventListener('scrollend', function (e) {
            if (e.detail.y <= e.detail.maxScrollY) {
              if (vm.isLoading === false) {
                if (++vm.params.pageNo <= vm.pageTotal) {
                  vm.loadingText = '加载中...'
                  vm.loadData()
                } else {
                  vm.loadingText = '没有更多'
                }
              }
            }
          });
          //回车事件监听
          mui('.mui-content').on('keydown', 'input', function (e) {
            if (e.which === 13) {
              var allinput = document.querySelectorAll("input")
//								if(!allinput[0].getAttribute('nowIndex')) {
              for (var i = 0; i < allinput.length; i++) {
                allinput[i].setAttribute('nowIndex', i)
              }
//								}
              var index = this.getAttribute('nowIndex')
              if (allinput[index * 1 + 1]) {
                allinput[index * 1 + 1].focus()
              }
            }
          })
          //监听键盘事件
          window.onresize = function () {
            mui('.mui-scroll-wrapper').scroll().element.scrollTop = 0;
          }
        },
        MathPrice: function (index) {
          var vm = this,
            price = '--'
          if (vm.list[index].coinsCount && vm.list[index].rewardCount) {
            if ((vm.list[index].rewardCount - vm.list[index].lastRewardCount) !== 0) {
              price = (vm.list[index].coinsCount - vm.list[index].lastCoinsCount) * (vm.currentShopObj.monetaryValue / 100) / (vm.list[index].rewardCount - vm.list[index].lastRewardCount)
              price = price.toFixed(2)
            } else {
              price = '--'
            }
          } else {
            price = '--'
          }
          return price
        },
        // 计算礼品误差
        goodsErroor: function (rewardCount, meterAmount, index, ind) {
          if (this.list[index].type === 1) {
            var rewardCount1 = this.list[index].rewards[ind].rewardCount1;

            if (meterAmount) {
              if (rewardCount1) {
//									this.$set(this.list[index].rewards[ind],'isTrue',true)
                var data = meterAmount - rewardCount1;
                if (data > 0) {
                  // this.$set(this.list[index].rewards[ind],'error','+'+data);
                  this.$set(this.list[index].rewards[ind], 'isTrue', true);
                  return '+' + data;
                } else if (data === 0) {
                  // this.$set(this.list[index].rewards[ind],'error',data)
                  this.$set(this.list[index].rewards[ind], 'isTrue', false);
                  return data;
                } else {
                  // this.$set(this.list[index].rewards[ind],'error',data);
                  this.$set(this.list[index].rewards[ind], 'isTrue', true);
                  return data;
                }
              } else {
                this.$set(this.list[index].rewards[ind], 'isTrue', false);
              }
            } else {
//								this.$set(this.list[index].rewards[ind],'isTrue',false);
            }

          } else {

          }
        },
        goodsTotalErroor: function (index) {
          var vm = this
          var total = 0;
//        if (this.meterType === 1) {
          vm.list[index].rewards.forEach(function (item) {
            total += (item.rewardCount - item.meterAmount)
          });
          if (vm.list[index].rewardCount !== '') {
            if (Math.abs(total - (vm.list[index].rewardCount - vm.list[index].lastRewardCount)) > 3) {
              this.$set(this.list[index], 'color', 1)
            } else if (Math.abs(total - (vm.list[index].rewardCount - vm.list[index].lastRewardCount)) === 0) {
              this.$set(this.list[index], 'color', 2)
            } else {
              this.$set(this.list[index], 'color', 3)
            }

            if ((vm.list[index].rewardCount - vm.list[index].lastRewardCount - total) > 0) {
              return '+' + ((vm.list[index].rewardCount - vm.list[index].lastRewardCount) - total)
            } else {
              return (vm.list[index].rewardCount - vm.list[index].lastRewardCount) - total
            }
          } else {
            this.$set(this.list[index], 'color', 2)
            return '--';
          }

//        }
        },

        save: function (index, type) {
          var vm = this,
            url, params = {},
            isFastMeter = false
          var btnArray = ['否', '是'];
          if (type === 1) {
            var goods = [];
            vm.list[index].rewards.forEach(function (item) {
              var obj = {}
              obj.goodsId = item.rewardId
              obj.realAmount = item.meterAmount
              obj.goodsAmount = item.rewardTrue? item.rewardCount1:item.rewardCount  
              goods.push(obj)
            })
            params = {
              storeId: vm.currentShopObj.storeId,
              deviceSn: vm.list[index].deviceSn,
              ticketDate: vm.userInfo.ticketDate,
              reportTime: vm.userInfo.time,
              rewardCount: vm.list[index].rewardCount,
              coinsCount: vm.list[index].coinsCount,
              goods: goods
            }
            url = '/deviceMeterRestore/reward'
            vm.saveAjax(index, url, params)
          }
          if (type === 0) {
            params = {
            	 storeId: vm.currentShopObj.storeId,
            	 deviceSn: vm.list[index].deviceSn,
            	 ticketDate: vm.userInfo.ticketDate,
        			reportTime:vm.userInfo.time,
            	buyCoinNum: vm.list[index].buyCoinNum,
            	cashAmount: vm.list[index].cashAmount,
            	coinsAmount:0,
            	incomeAmount:vm.list[index].incomeAmount
            }
            url = '/deviceMeterRestore/atm'
            vm.saveAjax(index, url, params)
          }
          if (type === 2) {
            params = {
            	storeId: vm.currentShopObj.storeId,
            	deviceSn: vm.list[index].deviceSn,
            	ticketDate: vm.userInfo.ticketDate,
            	reportTime:vm.userInfo.time,
            	ticketsCount: vm.list[index].ticketsCount,
            	coinsCount: vm.list[index].coinsCount,           	
            }
            url = '/deviceMeterRestore/game'
          
            vm.saveAjax(index, url, params)
          }
          console.log(JSON.stringify(params))
        },

        saveInfo: function (info) {
          var btnArray = ['确定'];
          mui.prompt('出币消费率：' + info.rate.consumption + '/br' + '礼品返奖率：' + info.rate.rewardOut, '请填写备注', '备注', btnArray, function (e) {
            if (e.index === 0) {
              config.ajax({
                url: '/deviceMeter/addMeterLog',
                data: {
                  storeId: info.storeId,
                  timestamp: info.timestamp,
                  reportNote: e.value
                },
                success: function (res) {
                  if (res.result === 1) {
                    mui.toast(res.errormsg)
                    mui.back()
                  } else {
                    mui.toast(res.errormsg)
                  }
                }
              })
            }
          })
        },
        edit: function (index) {
          vm.list[index].ifSave = false
          vm.logedAmount -= 1
        },
        saveAjax: function (index, url, params) {
          vm.list[index].ifSave = true;
          config.ajax({
            url: url,
            data: params,
            success: function (res) {
              if (res.result === 1) {
                mui.toast('保存成功！')
                vm.logedAmount++
              } else {
                vm.list[index].ifSave = false
                mui.toast(res.errormsg)
              }
            }
          })
        },
        loadData: function () {
          var vm = this
          this.isLoading = true
          config.ajax({
            url: '/deviceMeterRestore/get',
            data: vm.params,
            success: function (res) {
            	console.log(JSON.stringify(res.list[4]))
              if (res.result === 1) {
              	vm.isShow=true;
                vm.userInfo = {
                  name: res.reportMan,
                  time: res.reportTime,
                  ticketDate: res.ticketDate
                }
                vm.logedAmount = res.logedAmount
                //总共多少条数据
                vm.totalCount = res.totalCount

                res.list.forEach(function (item) {
                  // 判断是否保存
                  if (item.coinsCount === -1 && item.buyCoinNum === -1) {
                    item.coinsCount = ''
                    item.buyCoinNum = ''
                    item.rewardCount = ''
                    item.cashAmount = ''
                    item.ticketsCount = ''
                    item.rewards.forEach(function (item) {
                      item.meterAmount = ''
                    })
                    item.ifSave = false
                  } else {
                    item.ifSave = true
                  }
                  
                  if (item.type === 1) {
                    if (item.rewardCount) {
                      var  awardNum = item.rewardCount - item.lastRewardCount

                      if (awardNum > 0) {
                        item.rewards.forEach(function (itemdex, ind) {
                          awardNum = awardNum - itemdex.rewardCount;
                          itemdex.rewardTrue = true;
                          if (awardNum < 0) {
                            var data = itemdex;
                            data.rewardCount1 = Math.abs(awardNum);
                            vm.$set(item.rewards, ind, data)
                            awardNum = 0
                          } else if (awardNum === 0) {
                            var data = itemdex;
                            data.rewardCount1 = '0';
                            vm.$set(item.rewards, ind, data)
                          } else {
                            if (ind === item.rewards.length - 1) {
                              var data = itemdex;
                              data.rewardCount1 = '-' + Math.abs(awardNum);
                              vm.$set(item.rewards, ind, data)
                            } else {
                              var data = itemdex;
                              data.rewardCount1 = '0';
                              vm.$set(item.rewards, ind, data)
                            }
                          }
                        })
                      }else {
                      		item.rewards.forEach(function (itemdex, ind) {
                    			itemdex.rewardTrue = false;
                      	})
                    	}
                    } 
                  }
                });
                //  分页 添加数据 
                if (vm.pageNo === 1) {
                  vm.list = res.list
                } else {
                  vm.list = vm.list.concat(res.list)
                }
                // 总共多少页
                vm.pageTotal = Math.ceil(res.totalCount / 10)
                setTimeout(function () {
                  vm.isLoading = false
                }, 500)
              } else {
                mui.toast(res.errormsg)
                vm.isShow=false;
                setTimeout(function () {
                  vm.isLoading = false
                }, 500)
              }
            }
          })
        },
        blur2: function (lastAddRewardCount, rewardCount, lastRewardCount, rewardNegativeVigilance, rewardPlusVigilance, index, type) {
          if (lastAddRewardCount) {
            var centNum = (rewardCount - lastRewardCount - lastAddRewardCount) / lastAddRewardCount
            this.$set(this.list[index], 'isTrue2', (rewardNegativeVigilance / 100) < centNum && centNum < (rewardPlusVigilance / 100))
          } else {
            this.$set(this.list[index], 'isTrue2', false)
          }
          if (type === 1) {
            var awardNum = rewardCount - lastRewardCount;
            var vm = this;
            if (rewardCount) {
              if (awardNum > 0) {
                this.list[index].rewards.forEach(function (item, ind) {
                  awardNum = awardNum - item.rewardCount;
                  item.rewardTrue = true;
                  if (awardNum < 0) {
                    var data = item;
                    data.rewardCount1 = Math.abs(awardNum);
                    vm.$set(vm.list[index].rewards, ind, data)
                    awardNum = 0
                  } else if (awardNum === 0) {
                    var data = item;
                    data.rewardCount1 = 0;
                    vm.$set(vm.list[index].rewards, ind, data)
                  } else {
                    if (ind === vm.list[index].rewards.length - 1) {
                      var data = item;
                      data.rewardCount1 = '-' + Math.abs(awardNum);
                      vm.$set(vm.list[index].rewards, ind, data)
                    } else {
                      var data = item;
                      data.rewardCount1 = '0';
                      vm.$set(vm.list[index].rewards, ind, data)
                    }
                  }

                })
              }else {
              this.list[index].rewards.forEach(function (item, ind) {
                item.rewardTrue = false;
              })
            	}
            } 
          }


        }

      }
    })
  })
</script>

</html>